package com.smartwebx.ha.util;

import java.io.Serializable;

import com.google.common.base.Objects;

public class BasicTreeNode implements Serializable {
	/**
	 * 
	 */
	private static final long serialVersionUID = 4173238594098069041L;

	protected Integer id;
	protected Integer pid;
	protected String name;
	private String icon;

	public BasicTreeNode(Integer id, Integer pid, String name, String icon) {
		super();
		this.id = id;
		this.pid = pid;
		this.name = name;
		this.icon = icon;
	}

	public Integer getId() {
		return id;
	}

	public void setId(Integer id) {
		this.id = id;
	}

	public Integer getPid() {
		return pid;
	}

	public void setPid(Integer pid) {
		this.pid = pid;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getIcon() {
		return icon;
	}

	public void setIcon(String icon) {
		this.icon = icon;
	}

	@Override
	public int hashCode() {
		return Objects.hashCode(id, pid, name, icon);
	}

	@Override
	public boolean equals(Object obj) {
		if (obj instanceof BasicTreeNode) {
			BasicTreeNode other = (BasicTreeNode) obj;
			return Objects.equal(id, other.id) && Objects.equal(pid, other.pid)
					&& Objects.equal(name, other.name)
					&& Objects.equal(icon, other.icon);
		} else {
			return false;
		}
	}

	@Override
	public String toString() {
		return Objects.toStringHelper(BasicTreeNode.class).add("id", id)
				.add("pid", pid).add("name", name).add("icon", icon).toString();
	}
}
